package com.kaifamiao.month05.day09;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;

public class Demo05 {

    public static void main(String[] args) {
        ScheduledExecutorService es = Executors.newSingleThreadScheduledExecutor();
        for (int i = 0; i < 10; i++) {
            es.execute(new Runnable() {
                @Override
                public void run() {
                    System.out.println(Thread.currentThread().getName() + " , 执行时间: " + System.nanoTime());
                }
            });
        }
        es.shutdown(); // 关闭线程池
    }
}
